import { defineConfig } from 'vite';
import eslintPlugin from 'vite-plugin-eslint';
import vue from '@vitejs/plugin-vue';
import path from 'path';

// https://vite.dev/config/
export default defineConfig({
    // vite中sass警告JS API过期的解决：https://blog.csdn.net/CssHero/article/details/142686148
    css: { preprocessorOptions: { scss: { api: 'modern-compiler' } } },
    plugins: [
        vue(),
        // 配置eslint检查
        eslintPlugin({
            include: ['src/**/*.js', 'src/**/*.vue', 'src/*.js', 'src/*.vue'],
            exclude: [],
            fix: false, // 自动修复
        }),
    ],
    resolve: {
        alias: {
            // @指向绝对路径下的src文件夹
            '@': path.resolve(__dirname, './src'),
        },
    },
});
